IF OBJECT_ID('dbo.GetDateTypes') IS NOT NULL
BEGIN
    DROP PROCEDURE dbo.GetDateTypes
    IF OBJECT_ID('dbo.GetDateTypes') IS NOT NULL
        PRINT '<<< FAILED DROPPING PROCEDURE dbo.GetDateTypes >>>'
    ELSE
        PRINT '<<< DROPPED PROCEDURE dbo.GetDateTypes >>>'
END
go
-- =======================================================================
-- Procedure Name: dbo.GetDateTypes
--
-- Author:      Kevin Cashman, Parallax Consulting LLC
--
-- Create date: 8/6/2007
--
-- Description: Returns list of valid DateTypes to Reporting FrontEnd
--
-- Parameters:  None
--              
-- Returns:     INT, 0=Success, -1=Error
--
-- SampleCall:
-- EXECUTE dbo.GetDateTypes()
--
--------------------------------------------------------------------------
-- Date        Initials  Modification
--------------------------------------------------------------------------
-- 8/6/07      KC        Created
-- 8/15/07     KC        Put ORDER BY
-- =======================================================================
CREATE PROCEDURE dbo.GetDateTypes
 
AS
BEGIN
     /*  Returned Fields for Dropdown
     --------------------------------
     DateValue           INT
     DateType            VARCHAR
     */

     -- Initial Settings
     SET NOCOUNT ON
     
     -- Declare Local Variables
     DECLARE   @Error            INT,
               @RowCount         INT
               
     -- Result Query    
     SELECT    1 AS DateValue,
               'Created' AS DateType
     UNION
     SELECT    2 AS DateValue,
               'Deadline' AS DateValue
     ORDER BY DateValue               
     
     SELECT @Error=@@ERROR,@RowCount=@@ROWCOUNT
     IF @Error!=0
          RETURN -1

     -- Return Success
     RETURN 0
     
END
go

IF OBJECT_ID('dbo.GetDateTypes') IS NOT NULL
    PRINT '<<< CREATED PROCEDURE dbo.GetDateTypes >>>'
ELSE
    PRINT '<<< FAILED CREATING PROCEDURE dbo.GetDateTypes >>>'
go

GRANT EXECUTE ON dbo.GetDateTypes TO InsightReport,Insight
go
